package generic;

import org.jetbrains.annotations.NotNull;

public interface ComparableShape extends Comparable<ComparableShape> {
    double getArea();
}

class ComparableCircle implements ComparableShape{

    private double radius;

    public ComparableCircle(double radius) {
        this.radius = radius;
    }

    @Override
    public double getArea() {
        return Math.PI * radius * radius;
    }

    @Override
    public int compareTo(@NotNull ComparableShape otherComparableCircle) {
        return Double.compare(getArea(),otherComparableCircle.getArea());
    }
}

class  ShapeUtils {

    public static <T extends ComparableShape> T getLargerShape(T shape1,T shape2){
       return shape1.compareTo(shape2)>0?shape1:shape2;
    }



}

class SuperShapeUtils<T extends ComparableShape>{

    private T shape1;
    private T shape2;
    public SuperShapeUtils() {
    }

    public SuperShapeUtils(T shape1,T shape2) {
        this.shape1=shape1;
        this.shape2=shape2;
    }

    public T compare(){
        return shape1.compareTo(shape2)>0?shape1:shape2;
    }

}



